package base.io;

import java.io.*;

public class BufferedReaderAndWriterLine {
  private static String COMMON_PATH = "E:%stest%s";
  
  public static void main(String[] args) throws IOException {
    File inputFile = new File(String.format(COMMON_PATH + "reader.md", File.separator, File.separator));
    File outputFile = new File(String.format(COMMON_PATH + "writer01.md", File.separator, File.separator));
    
    FileReader fileReader = new FileReader(inputFile);
    FileWriter fileWriter = new FileWriter(outputFile);
    
    BufferedReader bufferedReader = new BufferedReader(fileReader);
    BufferedWriter bufferedWriter = new BufferedWriter(fileWriter);
    
    String line = "";
    // 这里设置 按“行”读数据
    while ((line = bufferedReader.readLine()) != null) {
      // 这里要开启一个新行，然后开始写
      bufferedWriter.newLine();
      bufferedWriter.write(line);
    }
    
    bufferedReader.close();
    bufferedWriter.close();
  }
}
